﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace VehicleManagement.Models
{
        // CREATE	TABLE DriverManInfo
        //(
        //DriverManID int  IDENTITY(1,1) primary key,
        //DriverMan_name varchar(18)  not null ,
        //DriverMan_password varchar(18) not null,
        //Passw_ques varchar(30),
        //Passw_answer varchar(30),
        //DriverMan_image varchar(100),
        //Email varchar(30),
        //Sex  char(2),
        //Telephone varchar(18),
        //Remark  varchar(100)
        //)

    public class DriverManager
    {
        public int DriverManagerID { get; set; }

        [DisplayName("姓名")]
        [Required(ErrorMessage = "姓名不能为空")]
        [StringLength(18, ErrorMessage = "姓名不能超过18位")]
        public string Name { get; set; }

        [DisplayName("密码")]
        //[Required(ErrorMessage = "密码不能为空")]
        [DataType(DataType.Password)]
        [StringLength(18, ErrorMessage = "密码不能超过18位")]
        public string Password { get; set; }

        [DisplayName("密保问题")]
        [StringLength(18, ErrorMessage = "问题不能超过18位")]
        public string Question { get; set; }

        [DisplayName("密保答案")]
        [StringLength(18, ErrorMessage = "答案不能超过18位")]
        public string Answer { get; set; }

        [DisplayName("照片")]
        public string Image { get; set; }

        [DisplayName("邮箱")]
        [Required(ErrorMessage = "邮箱不能为空")]
        [StringLength(30, ErrorMessage = "邮箱不能超过30位")]
        [RegularExpression(@"^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$", ErrorMessage = "邮箱格式不正确")]
        public string Email { get; set; }

        [DisplayName("性别")]
        public string Sex { get; set; }

        [DisplayName("电话")]
        [StringLength(18, ErrorMessage = "电话不能超过18位")]
        [RegularExpression(@"((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)", ErrorMessage = "号码格式不正确")]
        public string Telephone { get; set; }

        [DisplayName("备注")]
        [StringLength(100, ErrorMessage = "备注不能超过100位")]
        public string Remark { get; set; }

        [DisplayName("登录账号")]
        [RegularExpression(@"^[-\da-zA-Z]{1,18}$", ErrorMessage = "输入1到18位数字或字母")]
        public virtual string LoginName { get; set; }

        [DisplayName("公司名称")]
        public virtual string CompanyName { get; set; }
    }
}